#ifndef GEMM_H
#define GEMM_H
#include <stdint.h>
#include <stddef.h>
// #include "config.h"
#ifdef __cplusplus
extern "C" {
#endif


static inline void set_bit(unsigned char *const dst, size_t index) {
    size_t dst_i = index / 8;
    int dst_shift = index % 8;
    dst[dst_i] |= 1 << dst_shift;
    //dst[dst_i] |= 1 << (8 - dst_shift);
}

static inline unsigned char get_bit(unsigned char const*const src, size_t index) {
    size_t src_i = index / 8;
    int src_shift = index % 8;
    unsigned char val = (src[src_i] & (1 << src_shift)) > 0;
    //unsigned char val = (src[src_i] & (1 << (8 - src_shift))) > 0;
    return val;
}


// void gemm_T_cim(int TA, int TB, int M, int N, int K, int ALPHA,
//     int8_t* A, int lda,
//     int8_t* B, int ldb,
//     int BETA,
//     int8_t* C, int ldc,ArrayConfig &ac);

void gemm_T(int TA, int TB, int M, int N, int K, int ALPHA,
    int8_t* A, int lda,
    int8_t* B, int ldb,
    int BETA,
    int8_t* C, int ldc,int shift);


void gemm_nn_fast(int M, int N, int K, int8_t ALPHA,
    int8_t* A, int lda,
    int8_t* B, int ldb,
    int8_t* C, int ldc);



void gemm(int TA, int TB, int M, int N, int K, int8_t ALPHA,
                    int8_t *A, int lda,
                    int8_t *B, int ldb,
                    int8_t BETA,
                    int8_t *C, int ldc);

void gemm_cpu(int TA, int TB, int M, int N, int K, int8_t ALPHA,
        int8_t *A, int lda,
        int8_t *B, int ldb,
        int8_t BETA,
        int8_t *C, int ldc);

#ifdef __cplusplus
}
#endif
#endif
